package com.ipet.modules.sys.service.impl;

import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.Map;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.plugins.Page;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.ipet.common.utils.PageUtils;
import com.ipet.common.utils.Query;

import com.ipet.modules.sys.dao.PetInfoDao;
import com.ipet.modules.sys.entity.PetInfoEntity;
import com.ipet.modules.sys.service.PetInfoService;
import org.springframework.transaction.annotation.Transactional;


@Service("petInfoService")
public class PetInfoServiceImpl extends ServiceImpl<PetInfoDao, PetInfoEntity> implements PetInfoService {

    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        Page<PetInfoEntity> page = this.selectPage(
                new Query<PetInfoEntity>(params).getPage(),
                new EntityWrapper<PetInfoEntity>()
        );

        return new PageUtils(page);
    }

    @Override
    @Transactional(rollbackFor = Exception.class)
    public void save(PetInfoEntity petInfoEntity) {
        petInfoEntity.setCreateTime(new Date());
        this.insert(petInfoEntity);
    }

}
